package com.yeshen.pmtea.net;

import android.graphics.Bitmap;
import android.os.AsyncTask;

import com.yeshen.pmtea.callback.ImagecallBack;
import com.yeshen.pmtea.utils.HttpUtils;

/**
 * Created by Administrator on 2016/11/15.
 */

public class ImageAsyncTask extends AsyncTask<String,Void,Bitmap> {
    private ImagecallBack mImagecallBack;

    public ImageAsyncTask(ImagecallBack imagecallBack) {

        mImagecallBack = imagecallBack;
    }

    @Override
    protected Bitmap doInBackground(String... params) {
        Bitmap bitmap = HttpUtils.getBitmapDataFromNet(params[0]);
        return bitmap;
    }

    @Override
    protected void onPostExecute(Bitmap bitmap) {
        super.onPostExecute(bitmap);
        if (bitmap!=null){
            mImagecallBack.callBackImage(bitmap);
        }
    }
}
